﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LGCourt.Logic.NBL.DBEntities;
using LGCourt.Logic.BLL;

namespace lgweb.user
{
    public partial class regSuccess : System.Web.UI.Page
    {
        private string _UserName = string.Empty;
        private string _UserPWD = string.Empty;
        private string _Sexuality = string.Empty;
        private string _IdentityType = string.Empty;
        private string _IdentityCard = string.Empty;
        private string _Mobile = string.Empty;
        private string _Phone = string.Empty;
        private string _Email = string.Empty;
        private string _Address = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                getParam();
                createrInfo();
            }
        }

        //获取参数值
        private void getParam()
        {
            this._UserName = string.IsNullOrEmpty(Request.Form["txtUserName"]) ? "" : Request.Form["txtUserName"];
            this._UserPWD = string.IsNullOrEmpty(Request.Form["txtUserPWD"]) ? "" : Request.Form["txtUserPWD"];
            this._Sexuality = string.IsNullOrEmpty(Request.Form["hdnSexuality"]) ? "" : Request.Form["hdnSexuality"];
            this._IdentityType = string.IsNullOrEmpty(Request.Form["hdnIdentityType"]) ? "" : Request.Form["hdnIdentityType"];
            this._IdentityCard = string.IsNullOrEmpty(Request.Form["txtIdentityCard"]) ? "" : Request.Form["txtIdentityCard"];
            this._Mobile = string.IsNullOrEmpty(Request.Form["txtMobile"]) ? "" : Request.Form["txtMobile"];
            this._Phone = string.IsNullOrEmpty(Request.Form["txtPhone"]) ? "" : Request.Form["txtPhone"];
            this._Email = string.IsNullOrEmpty(Request.Form["txtEmail"]) ? "" : Request.Form["txtEmail"];
            this._Address = string.IsNullOrEmpty(Request.Form["txtAddress"]) ? "" : Request.Form["txtAddress"];
        }

        private void createrInfo()
        {
            UserInfo bll = new UserInfo();
            pUserInfo param = new pUserInfo();
            param.UserName = this._UserName;
            param.UserPWD = this._UserPWD;
            param.UserType = 0;
            param.Address = this._Address;
            param.Email = this._Email;
            param.IdentityCard = this._IdentityCard;
            param.IdentityType = (Byte)(this._IdentityType=="0"?0:1);
            param.Mobile = this._Mobile;
            param.Phone = this._Phone;
            param.Sexuality = (Byte)(this._Sexuality == "0" ? 0 : 1);
            bool result = (bool)bll.CreateUser(param);


            if (result)
            {
                this.spMessage.Visible = true;
            }
            else
            {
                this.historyGo.Visible = true;
            }
        }

    }
}